#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
		if (nums.size() <=1)
			return nums.size();
		set<int> is;
		for_each(nums.begin(), nums.end(), [&](int i) {is.insert(i); });
		nums.clear();
		for_each(is.begin(), is.end(), [&](int i) {nums.push_back(i); });
		return  is.size();        

    }
};
int main()
{
	vector<int> v{ 1, 1, 2 };
	cout << Solution().removeDuplicates(v)<<endl;
	for (auto i : v)
		cout << i << " ";
	cout << endl;
}